#include <linux/unistd.h>

#include <stdlib.h>

#define BUFSIZ 1024

int get(int fd, long pos, char *buf, int n)
{
    if (lseek(fd, pos, 0) >= 0)
        return read(fd, buf, n);
    else
        return -1;
}

int main(int argc, char *argv[])
{
    int lido;
    char buf[BUFSIZ];
    int pos, n;
    int printf(const char *, ...);

    if (argc != 3)
        error("usage: lseek pos n");

    pos = atoi(argv[1]);
    n = atoi(argv[2]);

    lido = get(0, pos, buf, n);
    buf[lido] = '\0';
    printf("%s\n", buf);

    return 0;
}
